package com.gw.vip.server.config;

import com.gw.vip.common.exception.ExceptionEnums;
import com.gw.vip.common.exception.ServiceException;
import com.gw.vip.server.bo.IssuInfo;
import com.gw.vip.server.constants.SysArgKey;
import com.gw.vip.server.service.dao_service.SysArgService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author GW
 * @description
 * @since 2022-09-21
 */
@Configuration
@Slf4j
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class IssuInfoConfig {

    private final SysArgService sysArgService;

    @Bean
    public IssuInfo issuInfo(){
        //获取发行者信息
        IssuInfo issuInfo = sysArgService.getObject(SysArgKey.ISSU_INFO, IssuInfo.class);
        if (issuInfo==null){
            log.error("发行机构不存在！");
            return new IssuInfo();
        }
        return issuInfo;
    }
}
